public enum ColorEnum {
    Red,Green,Black,Yellow;

    public static void main(String[] args) {
        ColorEnum colorEnum1 = ColorEnum.Red;
        ColorEnum colorEnum2= ColorEnum.Green;
        ColorEnum colorEnum3 = ColorEnum.Black;
        ColorEnum colorEnum4 = ColorEnum.Yellow;

        ColorEnum[] arr = ColorEnum.values();
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i] + " " + arr[i].ordinal());
        }

        System.out.println(ColorEnum.Red.compareTo(ColorEnum.Black));
    }
}